package com.sau.pixelcart.controller;


import com.sau.pixelcart.common.result.Result;
import com.sau.pixelcart.domain.vo.OrderDetailVO;
import com.sau.pixelcart.service.IOrderDetailService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 订单商品明细（建议按月分表存储） 前端控制器
 * </p>
 *
 * @author Inton
 * @since 2025-03-27
 */
@Slf4j
@RestController
@RequestMapping("/orders/detail")
public class OrderDetailController {

    @Autowired
    private IOrderDetailService orderDetailService;

    /**
     * 查看订单详情
     * @param ordersId
     * @return
     */
    @GetMapping("/{ordersId}")
    public Result orderDetail(@PathVariable String ordersId){
        log.info("查询订单详情：{}",ordersId);
        List<OrderDetailVO> orderDetailVOList = orderDetailService.getByOrdersId(ordersId);
        return Result.success(orderDetailVOList);
    }

}
